package com.igeek.d0611.test1;

/**
 * @Author: zhiyu
 * @Date:17:31
 * @DESC:
 */
public class T_thread {
    public static void main(String[] args) {
        ThreadDemo threadDemo = new ThreadDemo();
        Thread thread = new Thread(threadDemo,"线程1");
        thread.start();
        System.out.println("====================简化========================");
        new Thread("线程2"){
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName()+":i="+i);
                }
            }
        }.start();
    }
}
class ThreadDemo extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName()+":i="+i);
        }
    }
}